package com.mzy.redis.controller;


import com.mzy.redis.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@Api(tags = "订单接口")
public class OrderController {

    @Resource
    private OrderService orderService;

    @GetMapping("/order/{orderId}")
    @ApiOperation("按照orderId查询订单")
    public String findOrderById(@PathVariable("orderId") Long orderId) {
        orderService.addOrder();
        return orderService.getOrderById(orderId);
    }

    @ApiOperation("新增订单")
    @PostMapping("/order/add")
    public void addOrder() {
        orderService.addOrder();
    }

}
